Programmers do the dumbest things
Ever do something really stupid in your code? I bet you can't say "No" with a straight face. But, don't you get irritated when you encounter someone else's blunders. I have found some real dillys lately and thought I might run them by anyone that ever reads my blog, which at this point is not a lot of people.
It seems that a lot of self-named .NET developers totally don't understand Exception Handling! For example, explain the need for the following Try Catch block, if you can.
private void DoNothing()
{
try
{
// do some code
}
catch(Exception ex)
{
throw(ex);
}
}
Did it never occur to the writer of this code that if they had not coded the try catch, that the results of a failure in the DoNothing method will be exactly the same. The try catch as coded basically is an unhandled exception, which could have been raised without the try catch.
Here's one more that completely baffled me when I came upon it recently.
Try
IO.File.Move(oldPath, newPath)
Catch (ex As Exception)
IO.File.Move(oldPath, newPath)
End Try
Go Figure! What is this? "If at first you don't succeed, Try, Try again?"
Take a minute and comment with something really dumb that you have done or seen.

10 Comments:
Get any Desired College Degree, In less then 2 weeks.
Call this number now 24 hours a day 7 days a week (413) 208-3069
Get these Degrees NOW!!!
"BA", "BSc", "MA", "MSc", "MBA", "PHD",
Get everything within 2 weeks.
100% verifiable, this is a real deal
Act now you owe it to your future.
(413) 208-3069 call now 24 hours a day, 7 days a week.
From your article:
Compact Framework - Use XML Files to Replace The Registry
Calling the following on a non existing xml:
CSettings cs = new CSettings(true);
cs.GetSetting("app", "colors", "foo", "bar");
cs.GetSetting("app", "fonts", "bar", foo");
will throw a null pointer exception.
The GetSetting code, specifically the following part:
if (ds == null)
{
dt = GetXml(Settings);
if (dt == null)
return KeyValue;
}
else
dt = ds.Tables[Settings];
wrongly assumes that if the dataset ds is created, the table named in "Settings" also is. In the given example, the table "colors" will get created by GetXml, but the following call for a setting from the "fonts" table will skip the table creation since ds is already != null and crash at for loop since dt = ds.Tables[Settings] sets dt to null.
Hi Les,
I might fall into your Dumb Prgrammers category with this. But Pls. helpme out. I am new to this and am using a FileSystemWatcher in a Windows Service.
The code is as below.
Public Class FlashTrapperService
Dim WithEvents fswFTWatch As System.IO.FileSystemWatcher
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
fswFTWatch = New System.IO.FileSystemWatcher()
username = My.User.Name
username = username.Remove(0, username.LastIndexOf("\") + 1)
If My.Computer.FileSystem.DirectoryExists("C:\Documents and Settings\" & username & "\Local Settings\Temporary Internet Files") Then
folderpath = "C:\Documents and Settings\" & username & "\Local Settings\Temporary Internet Files"
ElseIf My.Computer.FileSystem.DirectoryExists("D:\Documents and Settings\" & username & "\Local Settings\Temporary Internet Files") Then
folderpath = "D:\Documents and Settings\" & username & "\Local Settings\Temporary Internet Files"
End If
fswFTWatch.Path = folderpath
fswFTWatch.NotifyFilter = (IO.NotifyFilters.LastAccess Or IO.NotifyFilters.LastWrite Or IO.NotifyFilters.FileName Or IO.NotifyFilters.DirectoryName)
fswFTWatch.Filter = "*.swf"
AddHandler fswFTWatch.Changed, AddressOf fswFTWatch_Changed
AddHandler fswFTWatch.Created, AddressOf fswFTWatch_Changed
fswFTWatch.EnableRaisingEvents = True
fswFTWatch.IncludeSubdirectories = True
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
fswFTWatch.EnableRaisingEvents = False
End Sub
Private Sub fswFTWatch_Changed(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs)
flashfolder = "D:\TrappedFlashFiles\"
filename = e.FullPath
filename = filename.Remove(0, filename.LastIndexOf("\") + 1)
filename = flashfolder & filename
If e.ChangeType = IO.WatcherChangeTypes.Changed Then
My.Computer.FileSystem.CopyFile(e.FullPath, filename, True)
End If
End Sub
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
End Class
But when i start the service i keep getting the Error "The path is not of a Legal Form". This error comes at fswFTWatch.enableraisingevents=true
Pls. help me out here.
Regards
Rishi
It's worse than you think. The throw(ex) will change the call stack information so the error looks like it was in the catch block. What the developer wanted to do was just a "throw" without any parameters. That allows the exception to bubble up rather than wrapping the old exception in a new one. The coder actually made it harder to track down the bug.
hey, I just got a free $500.00 Gift Card. you can redeem yours at Abercrombie & Fitch All you have to do to get yours is Click Here to get a $500 free gift card for your backtoschool wardrobe
Is there an easy method in Visual C# 2005 to write a form load event. I am coming from VB6 and VB2005 where in you can pick on the item and browse the event on the right side.
There are a couple of ways of doing it.
First, double-click on the form, just like VB/VB.Net. The form load event will be opened or created.
Secondly, Select the form in project explorer, click the Events button in the properties window, scroll to the Load event and double-click it.
Start Making Money 'Processing Judicial Judgments'
One of a kind CD ROM with included media player and bonus material Never seen or ever has there been anything like it. Platform :: Windows 98/2000/ME/XP
don't have to print the whole thing out anymore cause you can't read it all sitting in front of your computer.
This CD Rom has the course cleverly seperated and ready for easy reading. No thumbing through the papers to cross reference or to get back to a certain page. Just click on the chapters and go exactly where you wanna go each and every time.
YOU DON'T NEED EXPERIENCE - OR A COLLEGE DEGREE -
TO BE SUCCESSFUL AS A JUDGMENT RECOVERY SPECIALIST!
Absolutely NO SELLING. You don't even have to talk to your clients.
Leave the comfort of your home ONLY occasionally to go to the courthouse.
Judgment recovery is in its infancy throughout the entire country but this industry is getting ready to explode!! There are literally millions of people in our country today who are holding a judgment that was awarded to them by the court, and they have no way to collect it. Judgment recovery is a tremendous business that is just catching fire, and it is very likely that you will be the only Judgment Recovery Specialist in your town.
You will recieve this business start up CD ROM with an option to purchase a website for your newly formed business go here to see what your website will look like: http://www.examplesite1.4t.com
What is judgment recovery?
When two people go to court over a dispute, only one of them wins. The winner (plaintiff), is awarded a judgment for a designated amount of money. Now comes the problem. How to collect the money owed to them. That's what judgment recovery is - the recovery of the funds awarded to the plaintiff in the judgment. The existing recovery methods leave a lot to be desired. Collections agencies don't work - all they do is send some nasty letters and make some phone calls. Attorneys will ask for a retainer, then it will cost an arm and a leg - if the attorney can collect it at all. Trying to collect it alone doesn't work, because no one knows how to go about it. So chances are, anyone awarded a judgment ends up holding a court-awarded piece of paper that does them absolutely no good whatsoever. All because no one knows HOW to collect the judgment! Having been awarded a judgment is one thing, collecting it is quite another.
The answer?
A Judgment Recovery Specialist! As a Recovery Specialist, you are the one they will come to in order to collect their judgment. The plaintiff will pay you a handsome commission to recover the money owing him from the judgment. No! You don't have to go to court or sue anyone, this has already been done by the plaintiff. You simply help him/her collect their money. So the age old dilemma of how to collect a judgment is quickly opening up a wide door of opportunity for millions of Americans, all because of Judgment Recovery Specialists. This is a long-awaited answer to a decades-old problem.
Is judgment recovery hard to do?
Not at all. Judgment recovery is not as difficult as collection agencies and attorneys would have the public believe. You locate your clients (those who have been awarded a judgment), by going to your local county court house, looking at the county records (these records are public and are available to anyone who wishes to see them), and making a list of those you want to contact. Then it's as simple as going home and sending them a letter explaining your services. You don't have to sell anything and you don't even have to talk to people on the phone if you don't want to. But you can believe once they get your letter and understand what you're going to do for them, they will be ringing your telephone off the hook. Getting your clients is no problem whatsoever. You'll find very quickly that you'll have more clients than you can handle. What a great position to be in. There are so few Recovery Specialists in the country that once the word gets around, you'll find business coming from everywhere!
Why will your clients be so anxious to pay you such great commissions?
Because 50% of something is better than 100% of nothing. And that's what they have now. Nothing! Just a piece of paper that says they are owed 'x' number of dollars. That's it! A piece of paper. They want the money in their hands, not a piece of paper, and they are delighted to pay you up to 50% of the recovered funds in order to get their share of the money. This is the standard commission structure for the judgment recovery industry.
A Judgment Recovery Specialist is the answer for millions of people. This course is designed to teach you everything you need to know about becoming a judgment recovery specialist. It will show you how to locate debtors and their assets anywhere in the country. All the tricks of the trade are here. Never before has there been such a complete, comprehensive course of this kind offered to the public. Here are some of the chapters in this fantastic manual:
Where to Find All the Judicial Judgments You Can Handle!
What to Look For
Having Judgments Assigned to You
Your Fees
Responses from Judgment Holders
Approaches
Debtor Work Sheet
Industry Etiquette
How to Find Debtors - ANYWHERE!
How to Find Debtor's Assets
Resources/Credit Bureaus
What Assets to Seize
Forms
Mailing a Summons
Collecting Post-Judgment Interest/Costs
Bankruptcy
Out of State Judgments
Samples of Letterhead/Business Envelopes
As in any profession that touches on utilizing state law, you will find that familiarizing yourself with the statutes in your particular state concerning the collection of judgments to be your best ally. There is no substitute for knowledge. This manual will teach you all you need to know about recovering judgments for others. Just think of how many people you personally know that are holding a worthless judgment because it can't be collected. Once you begin to talk about it, you'll find there are more people than you ever imagined that have been awarded a judgment, but have never been able to do anything to collect it. Now you can provide a valuable service to them and make yourself a tremendous income at the same time.
Your fees are based on a percentage of the judgment. As an example, if your client has a judgment for $5,000, and your fee to collect it is 50% of the judgment, your fee would be $2,500. You can see it wouldn't take too many judgments in a month's time to make an incredible income. A lot of your clients will be doctors, hospitals, jewelers, apartment owners, etc. These people often win multiple judgments and will be a source of continuous business for you. You can adjust your fee schedule downward for those who give you more than one judgment to collect. Hard work and dedication to your client are the secret ingredients to any business. Judgment recovery is no exception. We are not offering a "get-rich-quick" scheme. This is a highly professional, exceptionally lucrative way to earn your living without leaving the comfort of your home, except for trips to the court house and the bank. Just think of the respect you will command in your community. You and your family will be proud that you've chosen to be a Judgment Recovery Specialist.
I offer this item with website: View my company's site to see what yours will look like http://www.msjudg.8m.net ofcourse it can all be customized for you.
CD ROM also contains very important links and other information, 2 bonus ebooks are also included with this CD ROM already convienently installed on the disk. Plus this CD ROM also has a small media player on it, just in case you'd like to listen to your favorite tune while sharpening your knowledge.
free legal documentjudgments
i just want that i want a knowledge about dot net freamework,
and some question on that perticualr topic?
Finding Start and End Dates of Previous Week.
I found your article after reading another one that the DayOfWeek is an enumeration (1-7) so I tested out a slightly different way to do it.
dtSaleStart.Value = System.DateTime.Today.AddDays((System.DateTime.Today.DayOfWeek - 1) * -1)
dtSaleEnd.Value = System.DateTime.Today.AddDays((System.DateTime.Today.DayOfWeek - 7) * -1)
sets the 2 dates to the monday and sunday of this week. Just thought it was a neat alternative to the select case statment in your code. Your article helped me out a lot, Thanks.
Post a Comment
<< Home